PROCESS SYNCHRONIZATION
Experiment Number 2 : Binary Semaphores
Algorithm
• Step 1: Let entity access a critical condition.
• Step 2: Entity executes wait (P) in binary semaphore.
• Step 3: Semaphore checks integer value
If integer value=0, Semaphore places entity in Semaphore’s queue.
Entity waits and then Semaphore provides access unit to entity.
If integer value=1, Semaphore sets integer value to zero,
Then Semaphore provides access unit to entity.
• Step 4: Entity access critical section & executes on it.
• Step 5: Entity executes signal(V) in binary semaphore.
• Step 6: Entity leaves critical section.